import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
export function arrayMoveMutable(array, fromIndex, toIndex) {
  var startIndex = fromIndex < 0 ? array.length + fromIndex : fromIndex;

  if (startIndex >= 0 && startIndex < array.length) {
    var endIndex = toIndex < 0 ? array.length + toIndex : toIndex;

    var _array$splice = array.splice(fromIndex, 1),
        _array$splice2 = _slicedToArray(_array$splice, 1),
        item = _array$splice2[0];

    array.splice(endIndex, 0, item);
  }
}
export function arrayMoveImmutable(array, fromIndex, toIndex) {
  var newArray = _toConsumableArray(array);

  arrayMoveMutable(newArray, fromIndex, toIndex);
  return newArray;
}